from common.BasePage1 import BasePage1
class LoginPage1(BasePage1):
    def __init__(self,driver=None):
        super().__init__(driver)
        self.account_loc = "id,account"
        self.password_loc = "id,password"
        self.submit_loc = "id,submit"
        self.assert_text_loc = "xpath, /html/body/div[2]/div/div/div[1]/div"
        self.open("http://localhost/ranzhi/www/sys/user-login-L3JhbnpoaS93d3cvY3JtL2N1c3RvbWVyLWJyb3dzZS5odG1s.html")
    #把页面操作定义为函数
    def enter_account(self,username):
        self.input(self.account_loc,username)
        self.wait(1)
    def enter_password(self,password):
        self.input(self.password_loc,password)
        self.wait(1)
    def click_login_button(self):
        self.click(self.submit_loc)
        self.wait(2)
    def get_assert_text(self):
        return self.get_ele_text(self.assert_text_loc)
    def test_login(self,username="123456",password="123456"):
        self.enter_account(username)
        self.enter_password(password)
        self.click_login_button()
if __name__ == '__main__':
    lg = LoginPage1()
    # lg.enter_account("123456")
    # lg.enter_password("123456")
    # lg.click_login_button()
    lg.test_login()


